<!-- START of single comment -->
<div class="comment <%= cycle :odd, :even %>" id="comment_<%= single_comment.id -%>">
	<a name="comment<%=single_comment.id %>"></a>
	<%- if params[:edit_comment_id] && params[:edit_comment_id] == single_comment.id.to_s && is_author_of?(single_comment) -%>
	  <!-- we're editing this comment -->
	  <%= render :partial => 'comments/comment_form', 
                 :locals => {:comment => single_comment, :commentable => single_comment.commentable, :button_name => 'Update'.t} -%>	  
	<%- else -%>
		<%- if single_comment.is_deleted -%>
		  <p>(<%=sanitize_whitelist 'previous comment by %s deleted'.t / get_pseud_or_mailaddress(single_comment) -%>)</p>
		<%- elsif single_comment.hidden_by_admin? && !logged_in_as_admin? -%>
		 <p>(<%=h "This comment is under review by an admin and is currently unavailable.".t -%>)</p>
		<%- else -%>
			<%- unless single_comment.pseud.nil? -%>
			  <p><img class="icon" src="/images/icon_placeholder.png" alt="icon placeholder"></p>
			<%- end -%>
			<h3><%= get_pseud_or_mailaddress(single_comment) %></h3>
			<%=sanitize_and_format_for_display single_comment.content %>
			<h4 class="datestamp"><%=h 'Posted'.t %>&nbsp;<%= single_comment.created_at.localize("%a %d %B %Y %I:%M %p") %></h4>
			<ul class="">
				<li id="add_comment_reply_link_<%= single_comment.id -%>"><%= add_comment_reply_link single_comment -%></li>
				<li id="thread_link">(<%= link_to "Thread".t, single_comment -%>)</li>
				<%- if is_author_of?(single_comment) -%>
					<li id="edit_comment_link_<%= single_comment.id -%>"><%= edit_comment_link single_comment -%></li>
				<%- end -%>
				<%- if is_author_of?(single_comment) || is_author_of?(single_comment.ultimate_parent) -%>				
					<li id="delete_comment_link_<%= single_comment.id -%>"><%= delete_comment_link single_comment -%></li>
				<%- elsif logged_in_as_admin? -%>
          <li><%= render :partial => 'admin/admin_options', :locals => {:item => single_comment} %></li>
				<%- end -%>
				<%- if single_comment.pseud.nil? and is_author_of?(single_comment.ultimate_parent) -%>
					<li id="tag_comment_as_spam_link_<%= single_comment.id -%>"><%= tag_comment_as_spam_link single_comment -%></li>
				<%- end -%>
			</ul>

			<!-- this is where the comment delete confirmation will be displayed if we have javascript -->
			<div id="delete_comment_placeholder_<%= single_comment.id -%>" style="display:none;">
			</div>
			
			<!-- if not, here is where we will render the delete-comment form -->
			<%- if params[:delete_comment_id] && params[:delete_comment_id] == single_comment.id.to_s -%>
				<%= render :partial => 'comments/confirm_delete', :locals => {:comment => single_comment} -%>
			<%- end -%>
	
			<!-- This is where the reply-to box will be added when "Reply" is hit, if the user has javascript -->	
			<div id="add_comment_reply_placeholder_<%= single_comment.id -%>" style="display: none;">
		    </div>
	
			<!-- if not, we will render the comment form if this is the comment we are replying to. -->
			<%- if params[:add_comment_reply_id] && params[:add_comment_reply_id] == single_comment.id.to_s -%>
			  <%= render :partial => 'comments/comment_form', 
						 :locals => {:comment => Comment.new, :commentable => single_comment, :button_name => "Add Comment".t} -%>
			<%- end -%>
		<%- end -%>
	<%- end -%>
</div>
<!-- END of single comment -->
